<template>
  <div class="container">
    <div class="hostApp">
      <div v-for="item in hostList" @click="goPage(item)">
        {{ item.name }}</div>
    </div>
    <div class="router-container">
      <router-view></router-view>
    </div>
  </div>
</template>
<script setup>
import { useRouter } from "vue-router"
let Router = useRouter()
let hostList = [{
  name: '首页',
  path: '/',
  isReplace: false
},
{
  name: '详情页',
  path: '/info',
  isReplace: false
}, {
  name: 'testVue项目',
  path: '/vue',
  isReplace: true
}, {
  name: 'testReact项目',
  path: '/react',
  isReplace: true
}]
function goPage(item) {
  if (item.isReplace) {
    Router.replace(item.path)
  } else {
    Router.push(item.path)
  }
}
</script>
<style lang="less">
html,
body {
  margin: 0;
  padding: 0;
}

#app {
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  border: 2px solid red;

  .container {
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;

    .hostApp {
      height: 100px;
      box-sizing: border-box;
      border: 1px solid green;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;

      &>div {
        margin: 0 20px;
      }
    }

    .router-container {
      margin-top: 10px;
      flex: 1;
      border: 2px solid #abcdfd;
      overflow: auto;
    }
  }
}
</style>
